module.exports = (app) => {
  const { TEXT, INTEGER, DATE, STRING, BOOLEAN } = app.Sequelize
  const LiftRecord = app.model.define('lift_record', {
    id: {
      type: INTEGER(20).UNSIGNED,
      primaryKey: true,
      autoIncrement: true,
      comment: '主键id'
    },
    title: {
      type: STRING(50),
      allowNull: false,
      comment: '标题'
    },
    content: {
      type: TEXT,
      allowNull: false,
      comment: '内容'
    },
    image: {
      type: TEXT,
      allowNull: true,
      comment: '图片'
    },
    status: {
      type: BOOLEAN,
      allowNull: false,
      defaultValue: 1,
      comment: '状态'
    },
    created_at: {
      type: DATE,
      get() {
        return new Date(this.getDataValue('created_at')).getTime()
      }
    },
    updated_at: DATE
  })
  return LiftRecord
}
